<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%-- 
    Document   : EmployeesByName
    Created on : May 18, 2013, 12:07:49 PM
    Author     : rmartinez
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <h1>Empleados por nombre</h1>
        <form action="ListByName" method="POST">
            Nombre:
            <input type="text" name="txtName" value="" />
            <input type="submit" value="Mostrar" />
        </form>
        <div id="Resultados">
            <c:if test="${not empty requestScope.error}">
                <p style="color: red;">${requestScope.error}</p>
            </c:if>
            <c:if test="${not empty requestScope.list}">
                <table border="1">
                    <thead style="color: white; background-color: blue;">
                        <tr>
                            <th>Código</th>
                            <th>Nombre</th>
                            <th>Apellido</th>
                            <th>Sueldo</th>
                            <th>Departamento</th>
                        </tr>
                    </thead>
                    <tbody>
                        <c:forEach var="r" items="${requestScope.list}">
                        <tr>
                            <td>${r.employee_id}</td>
                            <td>${r.first_name}</td>
                            <td>${r.last_name}</td>
                            <td>${r.salary}</td>
                            <td>${r.department_id}</td>
                        </tr>
                        </c:forEach>
                    </tbody>
                </table>
            </c:if><br>
            <a href="index.jsp">Volver al índice</a>
        </div>
    </body>
</html>
